﻿using System;

namespace XamlMvp
{
    public static class Binders
    {
        static IHydratorBinder hydrators;
        public static IHydratorBinder Hydrators
        {
            get
            {
                if (hydrators == null) hydrators = new HydratorBinder();

                return hydrators;
            }
            set
            {
                if (hydrators != null) throw new ArgumentException("Creating multiple instances of Hydrators is not allowed");

                hydrators = value;
            }
        }

        static IPresenterBinder presenters;
        public static IPresenterBinder Presenters
        {
            get
            {
                if (presenters == null) presenters = new PresenterBinder();
                return presenters;
            }
            set 
            {
                if (presenters != null) throw new ArgumentException("Creating multiple instances of Presenters is not allowed");
                presenters = value; 
            }
        }    
    }
}
